#ifndef __BSP_LED_H
#define	__BSP_LED_H

#include "stm32f4xx.h"

// LED_G
#define LED_G_PIN               GPIO_Pin_2
#define LED_G_PORT              GPIOB
#define LED_G_RCC_CLK           RCC_AHB1Periph_GPIOB

// 开灯
#define LED_G_ON  do{GPIO_WriteBit(LED_G_PORT, LED_G_PIN, Bit_SET);}while(0)

// 关灯
#define LED_G_OFF do{GPIO_WriteBit(LED_G_PORT, LED_G_PIN, Bit_RESET);}while(0)

// 开灯或关灯    a <- {Bit_RESET, Bit_SET}
#define LED_G(a)	GPIO_WriteBit(LED_G_PORT, LED_G_PIN, a)

// 翻转LED
#define LED_G_TOGGLE                                                            \
        do {                                                                    \
            if (GPIO_ReadOutputDataBit(LED_G_PORT, LED_G_PIN) != Bit_RESET) {   \
                GPIO_WriteBit(LED_G_PORT, LED_G_PIN, Bit_RESET);                \
            } else {                                                            \
                GPIO_WriteBit(LED_G_PORT, LED_G_PIN, Bit_SET);                  \
            }                                                                   \
        } while(0)

/* 初始化函数 */
void LED_Init(void);

#endif /* __BSP_LED_H */
